<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>键盘鼠标操作</title>
</head>
<body>
  <p>playwright键盘及鼠标操作演示</p>

  <input placeholder="请进行输入"></input>

  <p></p>

  <button id="db_click_btn" ondblclick="dbClick()">双击</button>
  <p id="demo1"></p>
  <button id="right_click_btn" oncontextmenu="rightClick(event)">右键</button>
  <p id="demo2"></p>

  <h3>页面弹框处理</h3>

  <button onclick="jsAlert()">Alert</button><p></p>
  <button onclick="jsConfirm()">Confirm</button><p></p>
  <button onclick="jsPrompt()">Prompt</button><p></p>
  <h4>结果：</h4><p id="result" style="color:green"></p>

  <h3>文件</h3>
  <input type="file">

  <h3>显示时间</h3>

  <p id="current_time"></p>

  <script>
    setInterval(function(){
      document.getElementById('current_time').innerHTML=new Date().toLocaleString();
    }, 1000)

    function jsAlert(){
      alert("这是一个Alert弹出框！");
      document.getElementById("result").innerHTML = "点击了Alert按钮";
    }

    function jsConfirm(){
      var c=confirm("这是一个Confirm弹出框！");
      var result = c == true ? "OK": "Cancel";
      document.getElementById("result").innerHTML = "点击了Confirm,选择了 "+result;
    }

    function jsPrompt(){
      var p = prompt("这是一个Prompt弹出框！");
      document.getElementById("result").innerHTML = "点击了Prompt,输入了"+p;
    }

    function dbClick(){
      document.getElementById("demo1").innerHTML="发生了双击，666"
    }
    function rightClick(e){
      document.getElementById("demo2").innerHTML="进行了右键点击，555"
      e.preventDefault();
    }
  </script>
</body>
</html>